﻿using Customer.Domain;
using Customer.Infrstructre.VendorManager;
using Customer.Read.API.Applcation.Command.VendorCommand;
using MediatR;

namespace Customer.Read.API.Applcation.CommandHandler.VendorCommandHandlers
{
    /// <summary>
    /// 反填供应商
    /// </summary>
    public class VendorFanCommandHandler : IRequestHandler<VendorFanCommand, Vendor>
    {
        private readonly IVendorRepository _vendorRep;
        public VendorFanCommandHandler(IVendorRepository _vendorRep)
        {
            this._vendorRep = _vendorRep;
        }

        public async Task<Vendor> Handle(VendorFanCommand request, CancellationToken cancellationToken)
        {
            return await _vendorRep.GetModelAsync(request.VendorId);
        }
    }
}
